package org.jeecg.enums.car;

/**
 * 充值状态
 */
public enum ChargeStatusEnum {
    CHANGE_STATUS_CONDUCT(0, "充值中"),
    CHANGE_STATUS_SUCCESS(1, "充值成功"),
    CHANGE_STATUS_ERROR(9, "充值失败"),
    ;

    private Integer code;
    private String desc;

    ChargeStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(Integer value) {
        if (value == null) return "";
        ChargeStatusEnum[] enums = values();
        for (ChargeStatusEnum typeEnum : enums) {
            if (value.intValue() == typeEnum.getCode().intValue()) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static Integer getValue(String desc) {
        ChargeStatusEnum[] enums = values();
        for (ChargeStatusEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }
}
